export const columnsRoving: BasicGridColumnProps[] = [
  {
    title: '品种',
    field: 'materialName',
    minWidth: 90
  },
  {
    title: '单纱重量(kg)',
    field: 'weightPerYarn',
    minWidth: 90
  },
  {
    title: '满纱库中满纱链条',
    field: 'fullSpinningCntInFullSpinningStores',
    minWidth: 90
  },
  {
    title: '重量(kg)',
    field: 'fullSpinningWeightInFullSpinningStores',
    minWidth: 90
  },
  {
    title: '粗纱库中满纱链条',
    field: 'fullSpinningCntInCsSpinningStores',
    minWidth: 90
  },
  {
    title: '重量(kg)',
    field: 'fullSpinningWeightInCsSpinningStores',
    minWidth: 90
  },
  {
    title: '车面（米）粗纱机',
    field: 'yarnLength',
    minWidth: 90
  },
  {
    title: '重量(kg)',
    field: 'yarnWeight',
    minWidth: 90
  },
  {
    title: '已完成空满管交换锭数',
    field: 'pipeChangedCnt',
    minWidth: 90
  },
  {
    title: '重量(kg)',
    field: 'pipeChangedWeight',
    minWidth: 90
  },
  {
    title: '肚中满纱锭数',
    field: 'fullPipeCntInCs',
    minWidth: 90
  },
  {
    title: '重量(kg)',
    field: 'fullPipeWeightInCs',
    minWidth: 90
  },
  {
    title: '合计重量(kg)',
    field: 'weightTotal',
    minWidth: 90
  }
]

export const columnsSpunyarn: BasicGridColumnProps[] = [
  {
    title: '品种',
    field: 'materialName',
    minWidth: 90
  },
  {
    title: '粗纱机剩余长度（m）',
    field: 'currentLengthCs',
    minWidth: 90
  },
  {
    title: '粗纱剩余重量(kg)',
    field: 'currentWeightCs',
    minWidth: 90
  },
  {
    title: '细纱车面当前长度（m）',
    field: 'currentLength',
    minWidth: 90
  },
  {
    title: '细纱车面当前重量(kg)',
    field: 'currentWeight',
    minWidth: 90
  }
]

export const columnsSliver = (res) => {
  const tempFirst: any = [
    {
      title: '品种',
      field: 'materialName',
      width: 200,
      fixed: 'left'
    },
    {
      title: '库存筒数',
      field: 'inventoryBarrel',
      minWidth: 100,
      fixed: 'left'
    },
    {
      title: '库存重量(kg)',
      field: 'inventoryWeight',
      minWidth: 120,
      fixed: 'left'
    },
    {
      title: '系数',
      field: 'coefficient',
      minWidth: 120,
      fixed: 'left'
    },
    {
      title: '上次盘存筒数',
      field: 'balanceBarrel',
      minWidth: 120,
      fixed: 'left'
    },
    {
      title: '上次盘存重量(kg)',
      field: 'balanceWeight',
      minWidth: 130,
      fixed: 'left'
    },
    {
      title: '在机数量(米)',
      field: 'spinningLength',
      minWidth: 130,
      fixed: 'left'
    }
  ]

  const tempLast: any = [
    {
      title: '品种',
      field: 'materialName',
      width: 200,
      fixed: 'left'
    }
  ]

  res.days.reverse()
  res.days.forEach((value) => {
    tempFirst.push({
      title: zhuanHuanTime(value),
      field: value,
      children: [
        {
          title: '生产',
          field: value + 'productionBarrel',
          minWidth: 70
        },
        {
          title: '消耗',
          field: value + 'consumBarrel',
          minWidth: 70
        },
        {
          title: '结余',
          field: value + 'balanceBerrel',
          minWidth: 70
        }
      ]
    })
    tempLast.push({
      title: zhuanHuanTime(value),
      field: value,
      minWidth: 80
    })
  })

  return [tempFirst, tempLast]
}

const zhuanHuanTime = (value) => {
  const a = value.toString().substr(2, 2)
  const b = value.toString().substr(4, 2)
  return a + '-' + b
}
